package ${package_name}.controller;
import java.util.List;
import com.wx.commons.tools.PageTool;
import ${package_name}.qo.${table_name}QO;
import ${package_name}.vo.${table_name}VO;
import ${package_name}.to.${table_name}DTO;
import ${package_name}.service.${table_name}Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

@RequestMapping('"/${table_name?uncap_first}"')
public class ${table_name}Controller{

    @Autowired
    private ${table_name}Service ${table_name?uncap_first}Service;

    @PostMapping("/save")
	public void save(@RequestBody ${table_name}DTO ${table_name?uncap_first}DTO) {
        ${table_name?uncap_first}Service.save(${table_name?uncap_first}DTO);
	}

    @GetMapping("/delete/{id}")
	public void delete(@PathVariable("id") String id) {
        ${table_name?uncap_first}Service.deleteById(id);
	}

    @PostMapping("/update")
	public void update(@RequestBody ${table_name}DTO ${table_name?uncap_first}DTO) {
        ${table_name?uncap_first}Service.updateById(${table_name?uncap_first}DTO);
	}

    @GetMapping("/get/{id}")
	public ${table_name}VO get(@PathVariable("id") String id) {
        ${table_name}VO ${table_name?uncap_first}VO = ${table_name?uncap_first}Service.getById(id);
		return ${table_name?uncap_first}VO;
	}

    @GetMapping("/get/list")
	public List<${table_name}VO> list(@RequestBody ${table_name}QO ${table_name?uncap_first}QO) {
    List<${table_name}VO> list = ${table_name?uncap_first}Service.queryList(${table_name?uncap_first}QO);
        return list;
    }

    @GetMapping("/get/page")
    public PageTool<${table_name}VO> page(@RequestBody ${table_name}QO ${table_name?uncap_first}QO) {
        PageTool<${table_name}VO> page = ${table_name?uncap_first}Service.queryPage(${table_name?uncap_first}QO);
            return page;
    }
}
